package cn.com.twoke.easyproject.common.utils;

import cn.com.twoke.easyproject.common.exception.BusinessException;

public class ExceptionUtils {

    /**
     * 抛出运行异常
     * @param e
     */
    public static void throwException(RuntimeException e) {
        throw e;
    }

    /**
     * 抛出异常
     * @param e
     */
    public static void throwException(Exception e) {
        throw new RuntimeException(e);
    }

    /**
     * 返回业务异常
     * @param message
     * @return
     */
    public static RuntimeException createBusiness(String message) {
        return new BusinessException(message);
    }


    /**
     * 抛出业务异常
     * @param message
     */
    public static void throwBusinessException(String message) {
        throwException(createBusiness(message));
    }

}
